#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<assert.h>
void* my_memcpy(void* des, void* src, size_t num)
{
	assert(des && src);
	void* ret = des;
	int i = 0;
	if (src < des)
	{
		while (num--)
		{
			*((char*)des) = *((char*)src);
			des = (char*)des + 1;
			src = (char*)src + 1;
		}
	}
	else
	{
		while (num--)
		{
			*((char*)des + num) = *((char*)src + num);
		}
	}
	return ret;
}

int main()
{
	int arr1[] = { 1,2,3,4 };
	int arr2[20] = { 0 };
	my_memcpy(arr2, arr1, 16);
	int i = 0;
	for (i = 0; i < 4; i++)
	{
		printf("%d ", arr2[i]);
	}
}